﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormDesigner.MyControls
{
    public partial class MyTextBox : MyControl
    {
        [Browsable(true)]
        [Category("MyControl")]
        public TextBox TextBox { get; } = new TextBox();

        public MyTextBox()
        {
            InitializeComponent();

            Load += MyTextBox_Load;
        }

        private void MyTextBox_Load(object? sender, EventArgs e)
        {
            panel.Controls.Add(TextBox);
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            TextBox.Width = panel.Width;
            TextBox.Top = panel.Height / 2 - TextBox.Height / 2;
        }
    }
}
